//
//  Passcode.h
//  Pocket Doctor alpha version
//
//  Created by Sherif, Yin, Taylor, Jacob, Anna, Mike on 11-10-25.
//  Copyright (c) 2011 __Sytjam__. All rights reserved.
//
//Class Description: Ask for Passcode before launching medicine view or calendar.
//                   Recovering passcode can be achieved from here as well. (forget passcode)
//
//Known Bugs: none.
//

#import <UIKit/UIKit.h>
#import "AppDelegate.h"
@class MainMenu;
@class MedicineView;

@class KalViewController;

@interface Passcode : UIViewController{

 //   int DB_editMode; //This state variable specifies what sort of operations we're performing
                    //On the database when we're editing a medicine. In the current implementation:
                    // 100 means INSERT
                    // 200 means UPDATE
                    // More operations, such as DELETE, will be implemented in the future.
    int editID; // This is the medicine we're going to edit, specified by its ID.
                    // If the edit mode is Edit, then this ID will be needed to retrieve its
                    // information.
                // If we are not going to be editing medicine, the value of this will be -1 and we will instead add medicine.
    int medicineOrCalendar;
    
    MainMenu *mm;
    MedicineView *mv;
    
    //Point to the appDelegate for its SQLite database pointer.
    AppDelegate * aD;
    
    KalViewController *kal;


    
    //Outlets
    UITextField *passcode;
    UIButton *go;
    UIButton *forgotPasscode;
    UILabel *hint;
    UILabel *secretQuestion;
    UILabel *passcodeContain;
    UILabel *secretAnswerContain;
    UITextField *secretAnswer;
    UIButton *cancel;
    UIButton *done;
    UIBarButtonItem *back;
}

@property (retain,nonatomic) MainMenu *mm;
@property (retain,nonatomic) MedicineView *mv;
@property (retain, nonatomic) AppDelegate *aD;
@property (retain, nonatomic) KalViewController *kal;


@property (nonatomic) int editID;
@property (nonatomic) int medicineOrCalendar;


@property(retain,nonatomic) IBOutlet UITextField *passcode;
@property(retain,nonatomic) IBOutlet UIButton *go;
@property(retain,nonatomic) IBOutlet UIButton *forgotPasscode;
@property(retain,nonatomic) IBOutlet UILabel *hint;
@property(retain,nonatomic) IBOutlet UILabel *secretQuestion;
@property(retain,nonatomic) IBOutlet UILabel *passcodeContain;
@property(retain,nonatomic) IBOutlet UILabel *secretAnswerContain;
@property(retain,nonatomic) IBOutlet UITextField *secretAnswer;
@property(retain,nonatomic) IBOutlet UIButton *cancel;
@property(retain,nonatomic) IBOutlet UIButton *done;
@property(retain,nonatomic) IBOutlet UIBarButtonItem *back;


- (IBAction)Forgot:(id)sender;
- (IBAction)Check:(id)sender;
- (IBAction)tapBackground:(id)sender;
- (IBAction)Cancel:(id)sender;
- (IBAction)Back:(id)sender;
- (IBAction)CheckSecretAnswer:(id)sender;
- (IBAction)tapDoneKeyboard:(id)sender;
- (void)animateTextField: (UITextField *) textField up: (BOOL)up;
- (IBAction)textFieldDidEndEditing:(UITextField *)textField;
- (IBAction)textFieldDidBeginEditing:(UITextField *)textField;

@end
